function popupMenu() {
    let ass = document.querySelectorAll("#body1>.heart a")
    for (let i = 0; i < ass.length; i++) {
        ass[i].addEventListener("mouseenter", function () {
            let divs = this.querySelector("#body1>.heart a>div")
            if (divs) {
                divs.style.display = "block"
            }
        })
        ass[i].addEventListener("mouseleave", function () {
            let divs = this.querySelector("#body1>.heart a>div")
            if (divs) {
                divs.style.display = "none"
            }
        })
    }
}
popupMenu()//下拉框

function slideshow1() {
    let lis = document.querySelectorAll("#body2>.idolader ul li")
    let wps = document.querySelectorAll("#body2 .worship p")
    for (let i = 0; i < lis.length; i++) {
        lis[i].addEventListener("mouseenter", function () {
            for (let a = 0; a < lis.length; a++) {
                lis[a].classList.remove("lis")
                wps[a].classList.remove("chose")
            }
            lis[i].classList.add("lis")
            wps[i].classList.add("chose")
            index = i
        })
    }
    let index = 0
    window.setInterval(function () {
        index++;
        if (index > 4) {
            index = 0
        }
        for (let j = 0; j < lis.length; j++) {
            lis[j].classList.remove("lis")
            wps[j].classList.remove("chose")
        }
        lis[index].classList.add("lis")
        wps[index].classList.add("chose")
    }, 1000)
}
slideshow1()//第一个轮播图

function navigation() {
    let lis = document.querySelectorAll("#body3>.heart>.subnet>ul li")
    for (let i = 0; i < lis.length; i++) {
        lis[i].addEventListener("mouseover", function () {
            lis[i].classList.add("menue")
            let divs = this.querySelector("#body3>.heart>.subnet>ul li div")
            if (divs) {
                divs.style.display = "block"
            }
        })
        lis[i].addEventListener("mouseout", function () {
            lis[i].classList.remove("menue")
            let divs = this.querySelector("#body3>.heart>.subnet>ul li div")
            if (divs) {
                divs.style.display = "none"
            }
        })
    }
}
navigation() //第一个侧边栏子导航

function countDown() {
    let lis = document.querySelectorAll("#body3>.heart>.subnet>.sunnit ul li")
    let pss = document.querySelectorAll("#body3>.heart>.subnet>.sunnit div p")
    for (let i = 0; i < lis.length; i++) {
        lis[i].addEventListener("mouseover", function () {
            lis[i].style.background = "black"
            lis[i].style.color = "white"
            pss[i].style.display = "block"
        })
        lis[i].addEventListener("mouseout", function () {
            lis[i].style.background = "blue"
            lis[i].style.color = "white"
            pss[i].style.display = "none"
        })
    }
    let a1 = document.querySelector("#body3>.heart>.subnet>.sunnit div .a1")
    let a2 = document.querySelector("#body3>.heart>.subnet>.sunnit div .a2")
    let a3 = document.querySelector("#body3>.heart>.subnet>.sunnit div .a3")
    setInterval(function () {
        let minute = a1.innerHTML;
        minute--;
        a1.innerHTML = minute;
        if (minute === -1) {
            minute = 6;
            a1.innerHTML = minute;
        }
    }, 60000)
    setInterval(function () {
        let second = a2.innerHTML;
        second--;
        a2.innerHTML = second;
        if (second === -1) {
            second = 60;
            a2.innerHTML = second;
        }
    }, 1000)
    setInterval(function () {
        let millisecond = a3.innerHTML;
        millisecond--;
        a3.innerHTML = millisecond;
        if (millisecond === 0) {
            millisecond = 1000;
            a3.innerHTML = millisecond;
        }
    }, 1)
}
countDown()//倒计时

function belle() {
    let lis = document.querySelectorAll("#body3>.heart>.slideshow ul li")
    let pss = document.querySelectorAll("#body3>.heart>.slideshow .feature p")
    for (let i = 0; i < lis.length; i++) {
        lis[i].addEventListener("mouseover", function () {
            for (let a = 0; a < lis.length; a++) {
                lis[a].classList.remove("shouli")
                pss[a].classList.remove("showp")
            }
            lis[i].classList.add("shouli")
            pss[i].classList.add("showp")
            index = i;
        })
    }
    let index = 0;
    window.setInterval(function () {
        index++;
        if (index > lis.length - 1) {
            index = 0;
        }
        for (let j = 0; j < lis.length; j++) {
            lis[j].classList.remove("shouli")
            pss[j].classList.remove("showp")
        }
        lis[index].classList.add("shouli")
        pss[index].classList.add("showp")
    }, 1500)
}
belle()//美女图片轮播

function edaphon() {
    let spans = document.querySelectorAll("#body4>.heart .rightMost span")
    let pss = document.querySelectorAll("#body4>.heart>.shelfie .books p")
    for (let i = 0; i < spans.length; i++) {
        spans[i].addEventListener("mouseover", function () {
            for (let a = 0; a < spans.length; a++) {
                spans[a].classList.remove("show")
                pss[a].classList.remove("showp")
            }
            spans[i].classList.add("show")
            pss[i].classList.add("showp")
        })
    }
}
edaphon()//电子书选项卡


function product() {
    let as = document.querySelectorAll("#body4>.heart>.shelfie .books p>.one>.transurethral a")
    let is = document.querySelectorAll("#body4>.heart>.shelfie .books p>.one i")
    for (let i = 0; i < is.length; i++) {
        as[i].addEventListener("mouseover", function () {
            for (let a = 0; a < as.length; a++) {
                as[a].classList.remove("aa")
                is[a].classList.remove("peach")
            }
            as[i].classList.add("aa")
            is[i].classList.add("peach")
            index = i;
        })
        let index = 0;
        window.setInterval(function () {
            index++;
            if (index > as.length - 1) {
                index = 0;
            }
            for (let j = 0; j < as.length; j++) {
                as[j].classList.remove("aa")
                is[j].classList.remove("peach")
            }
            as[index].classList.add("aa")
            is[index].classList.add("peach")
        }, 500)
    }
}
product() //产品

function recent() {
    let aAs = document.querySelectorAll("#body4>.heart>.shelfie .books p>.two>.crowded>b .peachers")
    let red = document.querySelectorAll("#body4>.heart>.shelfie .books p>.two>.crowded>i>span")
    for (let i = 0; i < aAs.length; i++) {
        red[i].addEventListener("mouseover", function () {
            for (let a = 0; a < aAs.length; a++) {
                aAs[a].classList.remove("aAs")
                red[a].classList.remove("red")
            }
            aAs[i].classList.add("aAs")
            red[i].classList.add("red")
            index = i
        })
        let index = 0
        setInterval(function () {
            index++;
            if (index > aAs.length - 1) {
                index = 0
            }
            for (let j = 0; j < aAs.length; j++) {
                aAs[j].classList.remove("aAs")
                red[j].classList.remove("red")
            }
            aAs[index].classList.add("aAs")
            red[index].classList.add("red")
        }, 1000)

    }
}
recent()//zui最新上架

function cabinet() {
    let dts = document.querySelectorAll("#body4>.heart>.bookrack>dl dt")
    let dds = document.querySelectorAll("#body4>.heart>.bookrack>dl dd")
    let spans = document.querySelectorAll("#body4>.heart>.bookrack>dl dt span")
    for (let i = 0; i < dts.length; i++) {
        dts[i].addEventListener("mouseover", function () {
            for (let a = 0; a < dts.length; a++) {
                dts[a].classList.remove("reveal")
                dds[a].classList.remove("close")
                spans[a].innerHTML = "+"
            }
            dts[i].classList.add("reveal")
            dds[i].classList.add("close")
            spans[i].innerHTML = "-"
            index = i;
        })
        let index = 0;
        setInterval(function () {
            index++;
            if (index > dts.length - 1) {
                index = 0;
            }
            for (let c = 0; c < dts.length; c++) {
                dts[c].classList.remove("reveal")
                dds[c].classList.remove("close")
                spans[c].innerHTML = "+"
            }
            dts[index].classList.add("reveal")
            dds[index].classList.add("close")
            spans[index].innerHTML = "-"
        }, 2000)
    }
}
cabinet() //新品美女

function star() {
    let spans = document.querySelectorAll("#body5>.navigation>.celebrity span")
    let lis = document.querySelectorAll("#body5>.depot .atlas")
    for (let i = 0; i < spans.length; i++) {
        spans[i].addEventListener("mouseover", function () {
            for (let a = 0; a < spans.length; a++) {
                spans[a].classList.remove("orange")
                lis[a].classList.remove("wrips")
            }
            spans[i].classList.add("orange")
            lis[i].classList.add("wrips")
        })
    }
}
star()//实力  偶像 选项卡

function femme() {
    let screen = document.querySelectorAll("#body5>.depot>.one>.engage .atlts")
    let reveals = document.querySelectorAll("#body5>.depot>.one>.engage .photos")
    for (let i = 0; i < screen.length; i++) {
        screen[i].addEventListener("mouseover", function () {
            for (let a = 0; a < screen.length; a++) {
                screen[a].classList.remove("screen")
                reveals[a].classList.remove("reveals")
            }
            screen[i].classList.add("screen")
            reveals[i].classList.add("reveals")
            index = i;
        })
        let index = 0;
        setInterval(function () {
            index++;
            if (index > screen.length - 1) {
                index = 0;
            }
            for (let b = 0; b < screen.length; b++) {
                screen[b].classList.remove("screen")
                reveals[b].classList.remove("reveals")
            }
            screen[index].classList.add("screen")
            reveals[index].classList.add("reveals")
        }, 2000)
    }
}
femme()//meinv美女12号

function supra() {
    let tomatos = document.querySelectorAll("#body5>.depot>.one>.appoin>.father>.brandish .tomato")
    let phones = document.querySelectorAll("#body5>.depot>.one>.appoin>.father>.talte>.phone")
    for (let i = 0; i < tomatos.length; i++) {
        tomatos[i].addEventListener("mouseover", function () {
            for (let a = 0; a < tomatos.length; a++) {
                tomatos[a].classList.remove("tomatos")
                phones[a].classList.remove("phones")
            }
            tomatos[i].classList.add("tomatos")
            phones[i].classList.add("phones")
            index = i;
        })
        let index = 0;
        setInterval(function () {
            index++;
            if (index > tomatos.length - 1) {
                index = 0;
            }
            for (let b = 0; b < tomatos.length; b++) {
                tomatos[b].classList.remove("tomatos")
                phones[b].classList.remove("phones")
            }
            tomatos[index].classList.add("tomatos")
            phones[index].classList.add("phones")
        }, 1000)
    }
}
supra() //hao好货来袭

function surname() {
    let character = document.querySelector("#layer>.gaine>.character")
    let layer = document.querySelector("#layer")
    character.addEventListener("click", function () {
        layer.classList.add("layers")
    })
}
surname()//蒙层

function building() {
    let toTop = document.querySelector("#floorPlan>.toTop")
    let toBottom = document.querySelector("#floorPlan>.toBottom")
    let firstFloor = document.querySelector("#floorPlan>.firstFloor")
    let twice = document.querySelector("#floorPlan>.twice")
    let secondFloor = document.querySelector("#floorPlan>.secondFloor")
    toTop.addEventListener("click", function () {
        let y = window.scrollY;//获取滚动的距离
        let timetop = setInterval(function () {
            y -= 20;
            window.scrollTo(0, y)
            if (y <= 0) {
                clearInterval(timetop)
            }
        }, 100)
        console.log(y);
    })//返回顶部
    toBottom.addEventListener("click", function () {
        let y = window.scrollY;//获取滚动的距离
        let timebottom = setInterval(function () {
            y += 20;
            window.scrollTo(0, y)
            if (y >= 2787) {
                clearInterval(timebottom)
            }
            console.log(y);
        }, 100)
    })//返回底部
    firstFloor.addEventListener("click", function () {
        let y = window.scrollY;
        let timefirst = setInterval(function () {
            if (y > 995) {
                y -= 20;
            } else if (y < 965) {
                y += 20;
            } else if (y < 995 && y > 965) {
                clearInterval(timefirst)
            }
            window.scrollTo(0, y)
        }, 100)
    })//一楼
    twice.addEventListener("click", function () {
        let y = window.scrollY;
        let timeTwice = setInterval(function () {
            if (y > 1710) {
                y -= 20;
            } else if (y < 1685) {
                y += 20
            } else if (y > 1685 && y < 1710) {
                clearInterval(timeTwice)
            }
            window.scrollTo(0, y)
        }, 100)
    })//二楼
    secondFloor.addEventListener("click", function () {
        let y = window.scrollY;
        let timeSecond = setInterval(function () {
            if (y > 2315) {
                y -= 20
            } else if (y < 2285) {
                y += 20
            } else if (y > 2285 && y < 2315) {
                clearInterval(timeSecond)
            }
            window.scrollTo(0, y)
        }, 100)
    })//三楼
}
building()//lo楼层

function redButton() {
    let uls = document.querySelector("#floorPlan .product>ul")
    let analogs = document.querySelector("#floorPlan analog")
    let products = document.querySelector("#floorPlan .product")
    products.addEventListener("mouseenter", function () {
        this.classList.add("products")
        uls.classList.add("uls")
        // analogs.classList.add("analogs")
        document.querySelectorAll("analog").forEach(function (i, v) {
            v.style.display = "none";
        })
    })
    products.addEventListener("mouseleave", function () {
        this.classList.remove("products")
        uls.classList.remove("uls")
        // analogs.classList.remove("analogs")
        document.querySelectorAll("analog").forEach(function (i, v) {
            v.style.display = "block";
        })
    })

}
redButton() //红色小圆点